package com.simple.configuration;

import java.util.Properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
//验证码配置
@Configuration
public class KaptchaConfig {
	
	@Bean
	public DefaultKaptcha defaultKaptcha() {
		DefaultKaptcha defaultKaptcha=new DefaultKaptcha();
		Properties  properties=new Properties();
		
		properties.setProperty("kaptcha.border", "yes");
		properties.setProperty("kaptcha.border.color","192,192,192");
		properties.setProperty("kaptcha.textproducer.font.color","32,178,170");
		properties.setProperty("kaptcha.image.width", "90");
		properties.setProperty("kaptcha.textproducer.font.size", "30");
		properties.setProperty("kaptcha.image.height", "38");
		properties.setProperty("kaptcha.session.key", "myKaptcha");
        properties.setProperty("kaptcha.textproducer.char.length","4");
        properties.setProperty("kaptcha.textproducer.font.names", "arial");
        properties.setProperty("kaptcha.noise.color", "255,96,0");
        properties.setProperty("kaptcha.noise.impl","com.google.code.kaptcha.impl.NoNoise");//去干扰

		Config config=new Config(properties);
		defaultKaptcha.setConfig(config);
		return defaultKaptcha;
	}
	

}
